A plugin for puppeteer-extra.
Install
yarn add puppeteer-extra-plugin-anonymize-ua
API
Table of Contents
Extends: PuppeteerExtraPlugin
Anonymize the User-Agent on all pages.
Supports dynamic replacing, so the Chrome version stays intact and recent.
Type: function (opts)
opts
Object Options (optional, default {}
)
opts.stripHeadless
boolean Replace HeadlessChrome
with Chrome
. (optional, default true
)opts.makeWindows
boolean Sets the platform to Windows 10, 64bit (most common). (optional, default true
)opts.customFn
Function A custom UA replacer function. (optional, default null
)
Example:
const puppeteer = require('puppeteer-extra')
puppeteer.use(require('puppeteer-extra-plugin-anonymize-ua')())
puppeteer.use(require('puppeteer-extra-plugin-anonymize-ua')({
customFn: (ua) => 'MyCoolAgent/' + ua.replace('Chrome', 'Beer')})
)
const browser = await puppeteer.launch()